package org.hs.phd.common.simpleplayer.filter;

import org.hs.phd.common.simpleplayer.ImageSequenceFrame;
import org.hs.phd.common.simpleplayer.PlayerFilter;

import com.googlecode.javacv.cpp.opencv_core;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_imgproc;

public class DownSampleFilter implements PlayerFilter{

	public DownSampleFilter() {
	}

	@Override
	public void filter(ImageSequenceFrame inputFrame) {
		IplImage input = inputFrame.getFrameImage();
		IplImage result = opencv_core.cvCreateImage(opencv_core.cvSize(input.width()/2, input.height()/2), input.depth(), input.nChannels());
		opencv_imgproc.cvPyrDown(input, result, opencv_imgproc.CV_GAUSSIAN_5x5);
		inputFrame.setFrameImage(result);
	}

}
